﻿using System;
using DapperExtensions.Mapper;
using Newtonsoft.Json;

namespace ZilLion.Service.WeChatMall.Domain.Entitys.GsInfo
{
    public class GsExtraInfoEntity
    {
        /// <summary>
        ///     货品id
        /// </summary>
        [JsonProperty("gsid")]
        public long GsId { get; set; }

        /// <summary>
        ///     好评数
        /// </summary>
        [JsonProperty("gsrating")]
        public int GsRating { get; set; }

        /// <summary>
        ///     月售出(随机数, 根据后台权重随机?)
        /// </summary>
        [JsonProperty("gssellcount")]
        public int GsSellCount { get; set; }

        /// <summary>
        ///     原价
        /// </summary>
        [JsonProperty("gsoldprice")]
        public decimal GsOldPrice { get; set; }

        /// <summary>
        ///     修改时间
        /// </summary>
        [JsonProperty("updatedtime")]
        public DateTime UpdatedTime { get; set; }
    }

    public class GsExtraInfoEntityMapper : ClassMapper<GsExtraInfoEntity>
    {
        public GsExtraInfoEntityMapper()
        {
            Table("gsextrainfo");
            Map(f => f.GsId).Column("gsid").Key(KeyType.Assigned);
            Map(f => f.GsRating).Column("gsrating");
            Map(f => f.GsSellCount).Column("gssellcount");
            Map(f => f.GsOldPrice).Column("gsoldprice");
            Map(f => f.UpdatedTime).Column("updatedtime");
        }
    }
}